<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
echo "<div class='fr'><a href='/auth/logout/'>Выйти</a></div>";
echo "<h1>Мои заказы</h1>";


$this->table->set_heading('Дата заказа', 'Номер заказа', 'Стоимость', 'Статус');
$tmpl = array('table_open' => '<table border="0" cellpadding="0" cellspacing="0" class="basket_table">');
$this->table->set_template($tmpl);

$class = 'orders';

$parents[0] = 'В процессе';
$parents[1] = 'Новый';
$parents[2] = 'Обработан';
$parents[3] = 'Отменен';

$colors[0] = '#e0ffe2';
$colors[1] = '#fffde0';
$colors[2] = '#e0f1ff';
$colors[3] = '#fde0ff';

foreach ($pages as $page) {

	$list = "";
	$list .= "<ul>";
	$listing = json_decode($page['order_data'], true);
	foreach ($listing as $item) {
		$list .= "<li>";
			$list .= $item['name'];
		$list .= "</li>";
	}
	$list .= "</ul>";
	$this->table->add_row(
			date("d.m.Y",$page['order_date']),
//			array('data'=>"Заказ № ".$page['order_id'],'style'=>'padding:0 0 0 20px;width:350px;'),
			array('data'=>"<a href='/client/show/".$page['order_id']."/'>Заказ № ".$page['order_id']."</a>",'style'=>'padding:0 0 0 20px;width:350px;'),
			array('data' => tonum($page['order_sum'])." руб", 'style' => 'text-align: center;width:255px;'),
//			array('data' => ($page['order_track'] != ""?$page['order_track']:"Не отправлена"), 'style' => 'text-align: center; width: 150px;'),
			array('data' => $parents[$page['order_status']], 'style' => 'background: '.$colors[$page['order_status']].';width: 170px;')
		);
}
if (sizeof($pages) > 0) {
	echo $this->table->generate();
} else {
	echo showmenotice('У вас пока нет ни одного заказа');
}
echo $paging;
echo "<div class='cc'></div>";

echo $form;
echo $js;
//echo $this->config_model->get('client_orders_text');
?>